package org.embedchat.database.nodb;

import org.embedchat.database.ItemNotFoundException;
import org.embedchat.database.UserDAOInterface;
import org.embedchat.entity.User;

public class UserDAO implements UserDAOInterface {

	private long counter = 0;
	
	public UserDAO(long counterValue) {
		this.counter = counterValue;
	}
	
	public User findUser(String login, String password) throws ItemNotFoundException {
		User guest = new User();
		guest.setId(counter++);
		if (login != null && !"".equals(login)) {
			guest.setLoginName(login);			
		} else {
			guest.setLoginName("guest_" + counter);			
		}
		guest.setLoginPassword(password);
		guest.setEmail("guest@embeddedchat.com");
		guest.setFirstName("guest");
		guest.setLastName("guest");
		return guest;
	}
}
